PROCESSES=`ps -Af | grep "spiderkit"`

EXISTPROCESS=0
HASKEY=0

for p in $PROCESSES; do
    if [ $p = "./bin/spiderkit" ] ; then
        EXISTPROCESS=1
    fi
    if [ $EXISTPROCESS = 1 ] ; then
        HASKEY=1
        break
    fi
done

if [ $HASKEY = 1 ] ; then
    echo "Send SIGQUIT ..."
    kill -3 `cat spiderkit.pid`
    rm spiderkit.pid
fi

sleep 1
ps -ef | grep spiderkit

